package GUIs;

import Graphics.FieldGraphics;
import java.awt.Graphics;
import javax.swing.JPanel;

/**
 *
 * @author johannes
 */
public class JFieldPanel extends JPanel {

    private FieldGraphics fg;
    private JHousePanel myHouse;

    public JFieldPanel(JHousePanel myHouse) {
//        System.out.println(myHouse);
        this.myHouse = myHouse;
    }

    public void setFieldGraphics(FieldGraphics fg) {
        this.fg = fg;
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        
        if (fg != null) {
            fg.drawFull(g, this.getWidth(), this.getHeight());
            if (myHouse != null) {
                myHouse.repaint();
            }
        }
    }

    @Override
    public void repaint() {
        super.repaint();
        if (myHouse != null) {
            myHouse.repaint();
        }
    }
}
